package com.controller;

import com.domain.Company;
import com.domain.User;
import com.mapper.companyMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;
import java.util.List;

@RestController
@Slf4j
public class HelloController {

	@Autowired
	private companyMapper mapper;

    @RequestMapping("/hello")
    public String hello(){
        return " hello Spring Boot !";
    }

	@RequestMapping("/userlist")
	public String findAll(){
		List<Company> list = mapper.selectAll();
		return list.toString();
	}

	//http://localhost:8081/Add?id=1&&&username=liumin&&password=123
	@RequestMapping("/Add")
	public String findAll(@Valid User user){
		System.out.println(user);
		return user.toString();
	}
}


